$(function(){
    $('.bk-items .lazy').lazyload({threshold: 200});
	//轮播
	var clone = $("#slide-c").html();
	function sd_vis(){
		var w = $(window).width();
		var vis = 3;
		if(w<1440){
			vis = 2;
		}
		$("#slide-c").html(clone);
		$("#slide-c").slide({
			titCell: ".hd ul li",
		    mainCell: ".bd ul",
			effect: "leftLoop",
			vis: vis,
			scroll: vis,
		    autoPlay: true,
		    trigger: "click",
		    interTime: 5000
		});
	}
	sd_vis();
	$(window).resize(function(){
		$("#slide-c").empty();
		sd_vis();
	});
	
	//文章展开全部
	$(".bk-tcont .cont-w .cont-items .item .see-all").click(function(){
		$(this).parent().prev(".item-c").css({"height":"auto","max-height":"100%","overflow":"visible"});
		$(this).addClass("hide");
	});

	var ele = $(".bk-tcont .cont-w .cont-items .item .item-c");
	for (var i=0; i<ele.length; i++) {
		if (ele.eq(i).height() >= 550) {
			ele.eq(i).next(".seeall").children(".see-all").removeClass("hide");
		}
	}
	
	//二级锚点跳转
	$(".bksort-top .bksort-twrap .cont-r a").click(function () {
		var index = $(this).index();
		var t = $(".bksort-cont .bksort-cl .bk-items .bk-lists").eq(index).offset().top;
		$('html,body').animate({
			'scrollTop': t - 100
		},1000);
	});

	//底部通栏
	$('.new-guide-bottom').addClass('isShow');
    $('.new-guide-bottom .close').on('click',function () {
        $('.new-guide-bottom').removeClass('isShow');
        $('.left-fixed-app').removeClass('hide');
    });
    $('.left-fixed-app').on('click',function () {
        $('.new-guide-bottom').addClass('isShow');
        $('.left-fixed-app').addClass('hide');
    });

    //广告轮播
    var cloneUl = $("#ul-slide").html();
    function sd_vis2(){
        $("#ul-slide").html(cloneUl);
        $("#ul-slide").slide({
            titCell: ".hd ul li",
            mainCell: ".bd ul",
            effect: "leftLoop",
            autoPlay: true,
            trigger: "click",
            interTime: 5000
        });
    }
    sd_vis2();
    $(window).resize(function(){
        $("#ul-slide").empty();
        sd_vis2();
    });

    $("#ul-slide2").slide({
        titCell: ".hd ul li",
        mainCell: ".bd ul",
        effect: "leftLoop",
        autoPlay: true,
        trigger: "click",
        interTime: 5000
    });

    $("#ul-slide3").slide({
        titCell: ".hd ul li",
        mainCell: ".bd ul",
        effect: "leftLoop",
        autoPlay: true,
        trigger: "click",
        interTime: 5000
    });

    $('.bksort-cont .bksort-cr .qr .cont1 .a-btn').on('click',function () {
        $('.bksort-cont .bksort-cr .qr .cont1').addClass('hide');
		$('.bksort-cont .bksort-cr .qr .cont2').removeClass('hide');
    });
});